home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / qic02_11.zip / MTIO.H < prev    next >
C/C++ Source or Header  |  1992-10-18  |  5KB  |  109 lines

  1. /*
  2.  * Copyright (c) 1982, 1986 The Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  *
  33.  *    @(#)mtio.h    7.6 (Berkeley) 2/5/91
  34.  */
  35.  
  36. /*
  37.  * Structures and definitions for mag tape io control commands
  38.  */
  39.  
  40. /* Modified for use with DOS Archive QIC02 device driver by
  41.  * Eddy Olk, eddy@duteca.et.tudelft.nl
  42.  */
  43.  
  44. /* structure for MTIOCTOP - mag tape op command */
  45. struct mtop {
  46.     short    mt_op;        /* operations defined below */
  47.     long    mt_count;    /* how many of them */
  48. };
  49.  
  50. /* operations */
  51. #define MTWEOF        0    /* write an end-of-file record */
  52. #define MTFSF        1    /* forward space file */
  53. #define MTBSF        2    /* backward space file */
  54. #define MTFSR        3    /* forward space record */
  55. #define MTBSR        4    /* backward space record */
  56. #define MTREW        5    /* rewind */
  57. #define MTOFFL        6    /* rewind and put the drive offline */
  58. #define MTNOP        7    /* no operation, sets status only */
  59. #define MTRESET        8    /* reset tape drive */
  60. #define MTERASE        9    /* erase */
  61. #define MTRETENSION    10    /* retension */
  62. #define MTEOD        11    /* seek eod */
  63.  
  64. /* structure for MTIOCGET - mag tape get status command */
  65.  
  66. struct mtget {
  67.     short    mt_type;    /* type of magtape device */
  68. /* the following two registers are grossly device dependent */
  69.     short    mt_dsreg;    /* ``drive status'' register */
  70.     short    mt_erreg;    /* ``error count'' register */
  71. /* end device-dependent registers */
  72.     short    mt_resid;    /* residual count */
  73.     short   mt_unrun;       /* underrun count */
  74.  
  75.     long    mt_fileno;    /* file number of current position */
  76.     long    mt_blkno;    /* block number of current position in file */
  77. };
  78.  
  79. /*
  80.  * Constants for mt_type byte.  These are the same
  81.  * for controllers compatible with the types listed.
  82.  */
  83. #define    MT_ISAR        0x01    /* Archive SC402/499 QIC-02 controller */
  84.  
  85. /* mag tape io control commands */
  86. #define    MTIOCTOP    3    /* do a mag tape op */
  87. #define    MTIOCGET    2    /* get tape status */
  88.  
  89. #define    DEFTAPE    "tape$"
  90.  
  91. /* error/status bit positions */
  92. #define MT_FIL     0x0001    /* File mark detected */
  93. #define MT_BNL     0x0002    /* Block not located */
  94. #define MT_UDE     0x0004    /* Unrecoverable data error */
  95. #define MT_EOM     0x0008    /* End of medium */
  96. #define MT_WRP     0x0010    /* Write protected cartridge */
  97. #define MT_DFF     0x0020    /* Device fault or SELF TEST failed */
  98. #define MT_CNI     0x0040    /* Cartridge not in place */
  99. #define MT_ST0     0x0080    /* Flag(s) set in this byte (0) */
  100.  
  101. #define MT_POR     0x0100    /* Power on or RESET occurred */
  102. #define MT_EOD     0x0200    /* End of recorded data */
  103. #define MT_PAR     0x0400    /* Bus parity error */
  104. #define MT_BOM     0x0800    /* Beginning of medium */
  105. #define MT_MBD     0x1000    /* Marginal block detected */
  106. #define MT_NDT     0x2000    /* No data detected */
  107. #define MT_ILL     0x4000    /* Illegal command */
  108. #define MT_ST1     0x8000    /* Flag(s) set in this byte (1) */
  109.